Skip to content

Allow code review comments crossing commit with right line number #35077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

lunny
Copy link
Member

@lunny lunny commented Jul 14, 2025

Fix #30844
Fix #21113
Related to #31551

  • Code review comments now support cross-commit referencing as long as the line still exists in the updated diff. Line numbers are dynamically calculated. The commit SHA in the negative line number of code comment is not right. It should be the BeforeCommitID but not AfterCommitID. A doctor command to fix it have been introduced.
  • Fixed a bug where force-pushing or rebasing the target branch could result in the merged commit IDs of the pull request being garbage collected and lost.
  • Remove unused method ReadPatchCommit.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 14, 2025
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/migrations labels Jul 14, 2025
@lunny lunny force-pushed the lunny/code_review_line_number branch 2 times, most recently from fd82a60 to 791339a Compare July 15, 2025 23:36
@@ -730,28 +730,23 @@ func prepareIssueViewCommentsAndSidebarParticipants(ctx *context.Context, issue
}
comment.Review.Reviewer = user_model.NewGhostUser()
}
if err = comment.Review.LoadCodeComments(ctx); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated with LoadAttributes

@lunny lunny force-pushed the lunny/code_review_line_number branch from 4e509fc to 3f4596f Compare July 16, 2025 17:03
@lunny lunny force-pushed the lunny/code_review_line_number branch from 3f4596f to aaed5c9 Compare July 19, 2025 01:35
@lunny lunny added this to the 1.25.0 milestone Jul 19, 2025
@lunny lunny changed the title Improve code review comments Allow code review comments crossing commit with right line number Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code review comment line number problem. Inline comments show up on wrong line if force push occurs before submitting comment
2 participants